package com.yuyou.fn.wx.service.impl;

import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.bean.menu.WxMenu;
import me.chanjar.weixin.common.bean.menu.WxMenuButton;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.Arrays;

@Service("teacherWeixinService")
public class TeacherWeixinServiceImpl extends WeixinServiceImpl{

    @Value("${teacher.wx.app.id}")
    private String wxAppId;

    @Value("${teacher.wx.secret}")
    private String wxSecret;

    @Value("${teacher.wx.token}")
    private String wxToken;


    @Override
    public WxMenu renderMenu() {
        WxMenu wxMenu = new WxMenu();
        WxMenuButton wxMenuButton = new WxMenuButton();
        wxMenuButton.setType(WxConsts.BUTTON_VIEW);
        wxMenuButton.setUrl("https://th5.yuyou100.com");
        wxMenuButton.setName("老师工作室");


        WxMenuButton wxMenuButton2 = new WxMenuButton();
        wxMenuButton2.setType(WxConsts.BUTTON_VIEW);
        wxMenuButton2.setUrl("https://th5.yuyou100.com/training_teacher.html");
        wxMenuButton2.setName("师训学堂");


        WxMenuButton wxMenuButton3 = new WxMenuButton();
        wxMenuButton3.setType(WxConsts.BUTTON_VIEW);
        wxMenuButton3.setName("誉优品学");

        WxMenuButton wxMenuButton3_1 = new WxMenuButton();
        wxMenuButton3_1.setType(WxConsts.BUTTON_VIEW);
        wxMenuButton3_1.setUrl("https://sh5.yuyou100.com/");
        wxMenuButton3_1.setName("我是学生");

        WxMenuButton wxMenuButton3_2 = new WxMenuButton();
        wxMenuButton3_2.setType(WxConsts.BUTTON_VIEW);
        wxMenuButton3_2.setUrl("http://b.yuyou100.com/bm");
        wxMenuButton3_2.setName("我是机构");

        wxMenuButton3.setSubButtons(Arrays.asList(wxMenuButton3_1,wxMenuButton3_2));


        wxMenu.setButtons(Arrays.asList(wxMenuButton,wxMenuButton2,wxMenuButton3 ));

        return wxMenu;
    }

    @Override
    public String getWxAppId() {
        return wxAppId;
    }

    @Override
    public String getWxSecret() {
        return wxSecret;
    }

    @Override
    public String getWxToken() {
        return wxToken;
    }

    public String getWhich() {
        return "teacher";
    }
}
